bldcfoc2 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

BLDC FOC 2 Click example. More...

#include "board.h"
#include "log.h"
#include "bldcfoc2.h"

Macros

#define BLDCFOC2_PROGRAM_EEPROM   0

Functions

void application_init (void)
void application_task (void)
int main (void)

Detailed Description

BLDC FOC 2 Click example.

Description

This example demonstrates the control of a 3-phase brushless DC motor using the BLDC FOC 2 Click board. The motor speed is gradually increased and decreased while changing direction on each cycle. The example also includes an optional EEPROM programming step if enabled via macro.

The demo application is composed of two sections :

Application Init

Initializes the logger and the Click board driver, applies the default configuration, and optionally programs the EEPROM if enabled.

Application Task

Gradually ramps the motor speed up and down, applies brake and switches direction on each full speed cycle. Speed is controlled via PWM duty cycle.

Note
To program the EEPROM, set the BLDCFOC2_PROGRAM_EEPROM macro to 1 and ensure that the on-board PROG SEL switch is set to SCL/SDA during EEPROM programming, then returned to SPD/FGO before motor drive. The default EEPROM configuration is optimized for the motor F80 PRO KV1900, 11.2V 10A power supply and PWM input range 10-50% at 20kHz.
Author
Stefan Filipovic

Macro Definition Documentation

◆ BLDCFOC2_PROGRAM_EEPROM

#define BLDCFOC2_PROGRAM_EEPROM   0

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )